﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace ASPNETMVC4Tutorial.Models
{
    public class Product
    {
        /// <summary>
        /// The ScaffoldColumn attribute tells ASP.NET MVC to skip the Id property when generating an editor form.
        /// </summary>
        [ScaffoldColumn(false)]
        public int Id { get; set; }

        /// <summary>
        /// Required attribute is used to validate the model. It specifies that the Name property must be a non-empty string.
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string Name { get; set; }

        public string Category { get; set; }

        public decimal Price { get; set; }

        public decimal ActualCost { get; set; }

        public decimal GetPriceWithTax(ITaxCalculator calculator)
        {
            return calculator.GetTax(Price) + Price;
        }


    }

    public interface ITaxCalculator
    {
        decimal GetTax(decimal rawPrice);
    }
}